package utils;

import com.alibaba.druid.pool.DruidDataSource;

public class DSUtil
{
    private static DruidDataSource ds;

    public static DruidDataSource getDataSource() {
        if (ds == null) {
            ds = new DruidDataSource();
            ds.setDriverClassName(ConfigUtil.getJDBCConfigValue("driver"));
            ds.setUrl(ConfigUtil.getJDBCConfigValue("url"));
            ds.setUsername(ConfigUtil.getJDBCConfigValue("username"));
            ds.setPassword(ConfigUtil.getJDBCConfigValue("password"));
        }
        return ds;
    }
}
